package pipe.reader.writer;

import java.io.IOException;
import java.io.PipedReader;

public class ReadData {
    public void readMethod(PipedReader input) {
        System.out.println("read:");
        char[] bytyArray = new char[20];
        int leadLength = 0;
        try {
            leadLength = input.read(bytyArray);

            while (leadLength != -1) {
                String newData = new String(bytyArray, 0, leadLength);
                System.out.println(newData);

            }

            input.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
